// 元信息
const meta = {
  requiresAuth: true, // 需要验证
  keepAlive: true // 需要缓存的
}

// 路由框架 懒加载方式加载路由
const routerFrame = {
  /**
   * Router两种模式 hash & history，默认hash
   * hash则带#，history不带#
   * 同时后端要进行代理配置（ 如nginx）
   **/
  mode: 'history',
  routes: [{
    path: '/',
    name: 'login',
    component: resolve => require(['@/pages/login/login'], resolve)
  }, {
    path: '/home',
    name: 'home',
    meta: {
      ...meta
    },
    component: resolve => require(['@/pages/home/home'], resolve),
    children: [
      /** 系统管理 ***/
      {
        path: 'role',
        name: 'role',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '系统管理'
          }, {
            page: '/home/role',
            title: '角色管理'
          }]
        },
        component: resolve => require(['@/pages/system/role/role'], resolve)
      }, {
        path: 'user',
        name: 'user',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '系统管理'
          }, {
            page: '/home/user',
            title: '用户管理'
          }]
        },
        component: resolve => require(['@/pages/system/user/user'], resolve)
      }, {
        path: 'department',
        name: 'department',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '系统管理'
          }, {
            page: '/home/department',
            title: '部门管理'
          }]
        },
        component: resolve => require(['@/pages/system/department/department'], resolve)
      }, {
        path: 'trainee',
        name: 'trainee',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '系统管理'
          }, {
            page: '/home/trainee',
            title: '学员管理'
          }]
        },
        component: resolve => require(['@/pages/system/trainee/trainee'], resolve)
      }, {
        path: 'log',
        name: 'log',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '系统管理'
          }, {
            page: '/home/log',
            title: '系统日志'
          }]
        },
        component: resolve => require(['@/pages/system/log/log'], resolve)
      },
      /** 基础材料 **/
      {
        path: 'transClass',
        name: 'transClass',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '基础材料'
          }, {
            page: '/home/transClass',
            title: '交易分类'
          }]
        },
        component: resolve => require(['@/pages/material/transClass'], resolve)
      }, {
        path: 'transaction',
        name: 'transaction',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '基础材料'
          }, {
            page: '/home/transaction',
            title: '交易分类'
          }]
        },
        component: resolve => require(['@/pages/material/transaction'], resolve)
      }, {
        path: 'evidenClass',
        name: 'evidenClass',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '基础材料'
          }, {
            page: '/home/evidenClass',
            title: '凭证分类'
          }]
        },
        component: resolve => require(['@/pages/material/evidenClass'], resolve)
      }, {
        path: 'evidence',
        name: 'evidence',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '基础材料'
          }, {
            page: '/home/evidence',
            title: '凭证模版'
          }]
        },
        component: resolve => require(['@/pages/material/evidence'], resolve)
      },
      /** 学习管理 **/
      {
        path: 'studyTask',
        name: 'studyTask',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '学习管理'
          }, {
            page: '/home/studyTask',
            title: '学习任务'
          }]
        },
        component: resolve => require(['@/pages/study/studyTask/studyTask'], resolve)
      }, {
        path: 'trainTask',
        name: 'trainTask',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '学习管理'
          }, {
            page: '/home/trainTask',
            title: '培训任务'
          }]
        },
        component: resolve => require(['@/pages/study/trainTask/trainTask'], resolve)
      },
      /** 考试管理 **/
      {
        path: 'paperManagement',
        name: 'paperManagement',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '考试管理'
          }, {
            page: '/home/paperManagement',
            title: '试卷管理'
          }]
        },
        component: resolve => require(['@/pages/exam/paperManagement/paperManagement'], resolve)
      }, {
        path: 'examManagement',
        name: 'examManagement',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '考试管理'
          }, {
            page: '/home/examManagement',
            title: '考试管理'
          }]
        },
        component: resolve => require(['@/pages/exam/examManagement/examManagement'], resolve)
      },
      /** 知识管理 **/
      {
        path: 'classification',
        name: 'classification',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '知识管理'
          }, {
            page: '/home/classification',
            title: '知识分类'
          }]
        },
        component: resolve => require(['@/pages/knowledge/classification/classification'], resolve)
      }, {
        path: 'document',
        name: 'document',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '知识管理'
          }, {
            page: '/home/document',
            title: '文档管理'
          }]
        },
        component: resolve => require(['@/pages/knowledge/document/document'], resolve)
      }, {
        path: 'video',
        name: 'video',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '知识管理'
          }, {
            page: '/home/video',
            title: '视频管理'
          }]
        },
        component: resolve => require(['@/pages/knowledge/video/video'], resolve)
      }, {
        path: 'answer',
        name: 'answer',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '知识管理'
          }, {
            page: '/home/answer',
            title: '问答管理'
          }]
        },
        component: resolve => require(['@/pages/knowledge/answer/answer'], resolve)
      },
      /** 报告管理 **/
      {
        path: 'studyReport',
        name: 'studyReport',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '报告管理'
          }, {
            page: '/home/studyReport',
            title: '学习报告'
          }]
        },
        component: resolve => require(['@/pages/report/studyReport/studyReport'], resolve)
      }, {
        path: 'examReport',
        name: 'examReport',
        meta: {
          ...meta,
          nodes: [{
            page: '/home',
            title: '报告管理'
          }, {
            page: '/home/examReport',
            title: '考试报告'
          }]
        },
        component: resolve => require(['@/pages/report/examReport/examReport'], resolve)
      }
    ]
  }]
}

export default {
  ...routerFrame
}
